import config from "@/config";
import http from "@/utils/request";

export default {
	add: {
		url: `${config.API_URL}/TaskScheduler/add`,
		name: "新增",
		post: async function (data) {
			return await http.post(this.url, data);
		},
	},
	update: {
		url: `${config.API_URL}/TaskScheduler/update`,
		name: "编辑",
		post: async function (data) {
			return await http.post(this.url, data);
		},
	},
	remove: {
		url: `${config.API_URL}/TaskScheduler/remove`,
		name: "删除",
		post: async function (data) {
			return await http.post(this.url, data);
		},
	},
	run: {
		url: `${config.API_URL}/TaskScheduler/run`,
		name: "运行 task",
		get: async function (data) {
			return await http.get(this.url + "/" + data);
		},
	},
	pause: {
		url: `${config.API_URL}/TaskScheduler/pause`,
		name: "暂停 task",
		get: async function (data) {
			return await http.get(this.url + "/" + data);
		},
	},
	resume: {
		url: `${config.API_URL}/TaskScheduler/resume`,
		name: "重置 task",
		post: async function (data) {
			return await http.get(this.url + "/" + data);
		},
	},
	detail: {
		url: `${config.API_URL}/TaskScheduler/detail`,
		name: "获取详情",
		post: async function (data) {
			return await http.get(this.url + "/" + data);
		},
	},
	logPage: {
		url: `${config.API_URL}/TaskScheduler/log/list`,
		name: "log 分页列表",
		get: async function (data) {
			return await http.post(this.url, data);
		},
	},
	list: {
		url: `${config.API_URL}/TaskScheduler/list`,
		name: "task列表",
		get: async function (data) {
			return await http.get(this.url, data);
		},
	},
	classJob: {
		url: `${config.API_URL}/TaskScheduler/class/job`,
		name: "task class job 列表",
		get: async function (data) {
			return await http.get(this.url, data);
		},
	},
};
